import request from '@/utils/request'

/**
 * 获取角色列表
 * @param { page，pagesize} params
 * @returns promise
 */

export function fetchRoleList(params) {
  return request({
    url: '/sys/role',
    method: 'GET',
    params
  })
}

export function fetchDelRole(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'DELETE'
  })
}

export function fetchAddRole(data) {
  return request({
    url: '/sys/role',
    method: 'POST',
    data
  })
}

export function fetchRoleDetail(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'GET'
  })
}

export function fetchUpdateRole(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'PUT',
    data
  })
}

export function assignPermission(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'PUT',
    data
  })
}
